﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using Ruleweaver.Rules;

namespace Ruleweaver
{
	[ContractClass(typeof(ISpecificationProviderContract))]
	public interface ISpecificationProvider
	{
		Specification<T> CreateSpecification<T>(T target, Rule rule);

		bool Execute<T>(T target, Rule rule);
	}

	[ContractClassFor(typeof(ISpecificationProvider))]
	internal abstract class ISpecificationProviderContract : ISpecificationProvider
	{
		Specification<T> ISpecificationProvider.CreateSpecification<T>(T target, Rule rule)
		{
			Contract.Requires(rule != null);
			Contract.Ensures(Contract.Result<Specification<T>>() != null);

			return null;
		}

		bool ISpecificationProvider.Execute<T>(T target, Rule rule)
		{
			Contract.Requires(rule != null);

			return false;
		}
	}
}